﻿@using MvcPaging
@model IPagedList<CashOrCard.Models.AdvtSite> 
<div class="search-content" id="search-result-list">
    <div class="pager"> 
        @Html.Raw(Ajax.Pager(
                        new Options
                        {
                            PageSize = Model.PageSize,
                            TotalItemCount = Model.TotalItemCount,
                            CurrentPage = Model.PageNumber,
                            ItemTexts = new ItemTexts() { Next = ">", Previous = "<", First="<<", Last=">>",  Page = "" },
                            ItemIcon = new ItemIcon() { First = "icon-backward", Previous = "icon-chevron-left", Next = "icon-chevron-right", Last = "icon-forward" },
                            TooltipTitles = new TooltipTitles() { Next = "Next page", Previous = "Previous page", Page = "Go to page {0}.", First = "Go To First Page", Last = "Go To Last Page" },
                            Size = Size.normal,
                            Alignment = Alignment.centered,
                            IsShowControls = true,
                            IsShowFirstLast = true,
                            CssClass = "light-theme "
                        },
                        new AjaxOptions
                        {
                            UpdateTargetId = "search-result-list",
                            OnBegin = "beginPaging",
                            OnSuccess = "successPaging",
                            OnFailure = "failurePaging"                                     
                        }, new { controller = "search", action = "QuickSearch", category=ViewData["category"], sitename=ViewData["sitename"], zipcode=ViewData["zipcode"], rbtcashcard=ViewData["rbtcashcard"], cashcard = ViewData["cashcard"] }))
    </div>
    @foreach(CashOrCard.Models.AdvtSite site in Model)
    {
    <div class="content-item">
        <div class="image-desc">
            <div class="image"><a href="/site/index/@Html.DisplayFor(modelItem=>site.AdvtSiteId)"><img src='@string.Format("{0}{1}.jpg", site.SiteThumb.Substring(0, @site.SiteThumb.Length - 4).Trim(), "_large")' /></a></div>
            <div class="desc">@site.SiteDescription</div>                    
        </div>
        <div class="content-body">
            <div class="site-name">@Html.ActionLink(site.SiteName, "index", "site", new { id = site.AdvtSiteId }, "")</div>
            <div class="ratingandvisit">
                <div class="star-rate">
                    @Html.Partial("_SiteRating", site)
                </div>
                <div class="visit-site"><input type="button" id="btn-vistsite" value="Visit Website" /></div>
            </div>                    
            <ul class="basic-info">                    
                <li class="address"><div class="title">Address:</div><div class="content">@site.Address</div></li>
                <li class="phone"><div class="title">Phone:</div><div class="content"> @site.PhoneNumber</div></li>
                <li class="cards"><div class="title">Cards Accepted:</div>
                    <div class="content cards">
                        <div class="cards-image">
                    @foreach (var cardItem in  site.CardTypes)
                    {
                        <img src="@cardItem.ThumbPath" />
                    } 
                            </div>
                    </div>
                </li>
                <li class="cash"><div class="title">Cash Accepted:</div>
                    <div class="content">@foreach (var cashItem in site.CashTypes)
                    {
                        <span>@cashItem.CashTypeName</span>
                    } 
                    </div>
                </li>                         
            </ul>
            <div class="promotion">the latest promotion:</div>
            <div class="promotion-content">
                @if(site.Promotions.Count > 0)
                {
                    @site.Promotions.FirstOrDefault().PromotionBody
                }
                else
                {
                    <span>will come soon...</span>
                }
            </div>
        </div>
    </div>
    }
</div>
